package com.yunlong.form;

import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * @author guorui
 * @date 2020-07-30 16:54
 */
@Data
@AllArgsConstructor
public class UserRegisterForm {
    @NotBlank(message = "学号不能为空")
    private String userId;
    @NotBlank(message = "姓名不能为空")
    private String userName;
    @NotBlank(message = "性别不能为空")
    private String userGender;
    @NotBlank(message = "部门不能为空")
    private String userDirection;
    @NotBlank(message = "邮箱不能为空")
    @Pattern(message = "邮箱格式错误，请重新输入", regexp = "^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")
    private String userEmail;
    /**
     *     其中(?![0-9]+$)表示排除掉只有数字的组合
     *     (?![a-zA-Z]+$)表示排除掉只有字母的组合，
     *     [0-9A-Za-z]表示必须有字母或数字
     *     必须包含数字和字母，6<个数<18
     */
    @Pattern(message = "密码格式错误，请重新输入", regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$")
    private String userPassword;
    @NotBlank(message = "进入年份不能为空")
    private String startYear;
}
